<template>
	<view class="clinical">
		<!-- 用药 -->
		<view class="clinical-box">
			<view class="box-header" :style="show1 == true ? '' : 'marginBottom:0'">
				<view class="header-left">
					<view class="left-line"></view>
					<text>用药 </text>
				</view>
				<view>
					<u-icon :name="show1 ? 'arrow-up' : 'arrow-down'" bold @click="show1 = !show1"></u-icon>
				</view>
			</view>
			<u-transition show>
				<view v-show="show1">
					<view class="box-form">
						<view class="form-left">
							患病的:
						</view>
						<view class="form-right"
							style="display: flex;align-items: center;justify-content: space-between;">
							<view class="right-input-box">
								第
								<view class="input-box-style">
									<u--input border="none" v-model="form.illDayNum" inputAlign="center" type="number"
										fontSize="22rpx" size="mini"></u--input>
								</view>
								天
							</view>
						</view>
						<view class="form-add">

						</view>
					</view>
					<view class="box-text">
						按口服静渡要化三种用药途径顺产填写药物名称
					</view>
				</view>
			</u-transition>
		</view>
		<!-- 口服 -->
		<view class="clinical-box">
			<view class="box-header" :style="show2 == true ? '' : 'marginBottom:0'">
				<view class="header-left">
					<view class="left-line"></view>
					<text>口服
					</text>
				</view>
				<view>
					<u-icon :name="show2 ? 'arrow-up' : 'arrow-down'" bold @click="show2 = !show2"></u-icon>
				</view>
			</view>
			<u-transition show>
				<view v-show="show2" v-for="(item,index) in form.takeOrallyArr" :key="index">
					<view class="box-form">
						<view class="form-left">
							用药名称:
						</view>
						<view class="form-right">
							<view class="input-box-style">
								<view class="right-input-box" style="width: 100%;">
									<view class="input-box-style" style="width: 100%;margin: 0;">
										<u--input border="none" size="mini" placeholder="请输入用药名称" v-model="item.name"
											fontSize="22rpx">
										</u--input>
									</view>
								</view>
							</view>
						</view>
						<view class="form-add">
							<u-icon name="plus" color="#54b6ab" size="16" @click="changeSize(2,1,index)"></u-icon>
							<u-icon name="minus" color="#54b6ab" @click="changeSize(2,0,index)"></u-icon>
						</view>
					</view>
					<view class="box-form">
						<view class="form-left">
							用药时间:
						</view>
						<view class="form-right">
							<uni-datetime-picker type="date" v-model="item.time" start="1990-01-01"
								:end="currentTime" />
						</view>
						<view class="form-add">

						</view>
					</view>
					<view class="box-form">
						<view class="form-left">
							日用药次数:
						</view>
						<view class="form-right">
							<view class="input-box-style">
								<view class="right-input-box" style="width: 100%;">
									<view class="input-box-style" style="width: 100%;margin: 0;">
										<u--input border="none" size="mini" placeholder="请输入日用药次数" fontSize="22rpx"
											type="number" v-model="item.num">

										</u--input>
									</view>
								</view>
							</view>
						</view>
						<view class="form-add">
							次
						</view>
					</view>
					<view class="box-form">
						<view class="form-left">
							单次药量:
						</view>
						<view class="form-right">
							<view class="input-box-style">
								<view class="right-input-box" style="width: 100%;">
									<view class="input-box-style" style="width: 100%;margin: 0;">
										<u--input border="none" size="mini" placeholder="请输入单次药量" fontSize="22rpx"
											type="digit" v-model="item.medicalWeight">

										</u--input>
									</view>
								</view>
							</view>
						</view>
						<view class="form-add">
							mg/ml/g
						</view>
					</view>
					<view class="box-form">
						<view class="form-left">
							已用药天数:
						</view>
						<view class="form-right">
							<view class="input-box-style">
								<view class="right-input-box" style="width: 100%;">
									<view class="input-box-style" style="width: 100%;margin: 0;">
										<u--input border="none" size="mini" placeholder="请输入已用药天数" v-model="item.useDay"
											type="number" fontSize="22rpx">

										</u--input>
									</view>
								</view>
							</view>
						</view>
						<view class="form-add">
							天
						</view>
					</view>
					<view class="box-form">
						<view class="form-left">
							药品图片:
						</view>
						<view class="form-right"
							style="display: flex;align-items: flex-start;justify-content: space-between;">
							<u-upload :fileList="item.imageUrl" @afterRead="afterRead" @delete="deletePic"
								uploadIconColor="#54b6ab" uploadIcon="plus" :name="{index:index,name:2}" :maxCount="1"
								accept="image"></u-upload>

						</view>
						<view class="form-add">

						</view>
					</view>

				</view>
			</u-transition>
		</view>
		<!-- 静脉 -->
		<view class="clinical-box">
			<view class="box-header" :style="show3 == true ? '' : 'marginBottom:0'">
				<view class="header-left">
					<view class="left-line"></view>
					<text>静脉
					</text>
				</view>
				<view>
					<u-icon :name="show3 ? 'arrow-up' : 'arrow-down'" bold @click="show3 = !show3"></u-icon>
				</view>
			</view>
			<u-transition show>
				<view v-show="show3" v-for="(item,index) in form.intravenousDripArr" :key="index">
					<view class="box-form">
						<view class="form-left">
							用药名称:
						</view>
						<view class="form-right">
							<view class="input-box-style">
								<view class="right-input-box" style="width: 100%;">
									<view class="input-box-style" style="width: 100%;margin: 0;">
										<u--input border="none" size="mini" placeholder="请输入用药名称" v-model="item.name"
											fontSize="22rpx">
										</u--input>
									</view>
								</view>
							</view>
						</view>
						<view class="form-add">
							<u-icon name="plus" color="#54b6ab" size="16" @click="changeSize(3,1,index)"></u-icon>
							<u-icon name="minus" color="#54b6ab" @click="changeSize(3,0,index)"></u-icon>
						</view>
					</view>
					<view class="box-form">
						<view class="form-left">
							用药时间:
						</view>
						<view class="form-right">
							<uni-datetime-picker type="date" v-model="item.time" start="1990-01-01"
								:end="currentTime" />
						</view>
						<view class="form-add">

						</view>
					</view>
					<view class="box-form">
						<view class="form-left">
							日用药次数:
						</view>
						<view class="form-right">
							<view class="input-box-style">
								<view class="right-input-box" style="width: 100%;">
									<view class="input-box-style" style="width: 100%;margin: 0;">
										<u--input border="none" size="mini" placeholder="请输入日用药次数" fontSize="22rpx"
											type="number" v-model="item.num">

										</u--input>
									</view>
								</view>
							</view>
						</view>
						<view class="form-add">
							次
						</view>
					</view>
					<view class="box-form">
						<view class="form-left">
							单次药量:
						</view>
						<view class="form-right">
							<view class="input-box-style">
								<view class="right-input-box" style="width: 100%;">
									<view class="input-box-style" style="width: 100%;margin: 0;">
										<u--input fontSize="22rpx" border="none" size="mini" placeholder="请输入单次药量"
											type="digit" v-model="item.medicalWeight">

										</u--input>
									</view>
								</view>
							</view>
						</view>
						<view class="form-add">
							mg/ml/g
						</view>
					</view>
					<view class="box-form">
						<view class="form-left">
							已用药天数:
						</view>
						<view class="form-right">
							<view class="input-box-style">
								<view class="right-input-box" style="width: 100%;">
									<view class="input-box-style" style="width: 100%;margin: 0;">
										<u--input fontSize="22rpx" border="none" size="mini" placeholder="请输入已用药天数"
											type="number" v-model="item.useDay">

										</u--input>
									</view>
								</view>
							</view>
						</view>
						<view class="form-add">
							天
						</view>
					</view>
					<view class="box-form">
						<view class="form-left">
							用药途径:
						</view>
						<view class="form-right">
							<u-radio-group v-model="item.useWay">
								<u-radio activeColor="#54b6ab" labelSize="22rpx" :name="1" label="口服"
									style="margin-right: 20rpx;"></u-radio>
								<u-radio activeColor="#54b6ab" labelSize="22rpx" :name="2" label="静滴"
									style="margin-right: 20rpx;"></u-radio>
								<u-radio activeColor="#54b6ab" labelSize="22rpx" :name="3" label="静推"></u-radio>
							</u-radio-group>
						</view>
						<view class="form-add">

						</view>
					</view>
					<view class="box-form">
						<view class="form-left">
							药品图片:
						</view>
						<view class="form-right"
							style="display: flex;align-items: flex-start;justify-content: space-between;">
							<u-upload :fileList="item.imageUrl" @afterRead="afterRead" @delete="deletePic"
								uploadIconColor="#54b6ab" uploadIcon="plus" :name="{index:index,name:3}" :maxCount="1"
								accept="image"></u-upload>

						</view>
						<view class="form-add">

						</view>
					</view>

				</view>
			</u-transition>
		</view>
		<!-- 雾化 -->
		<view class="clinical-box">
			<view class="box-header" :style="show4 == true ? '' : 'marginBottom:0'">
				<view class="header-left">
					<view class="left-line"></view>
					<text>雾化
					</text>
				</view>
				<view>
					<u-icon :name="show4 ? 'arrow-up' : 'arrow-down'" bold @click="show4 = !show4"></u-icon>
				</view>
			</view>
			<u-transition show>
				<view v-show="show4" v-for="(item,index) in form.atomizationArr" :key="index">
					<view class="box-form">
						<view class="form-left">
							用药名称:
						</view>
						<view class="form-right">
							<view class="input-box-style">
								<view class="right-input-box" style="width: 100%;">
									<view class="input-box-style" style="width: 100%;margin: 0;">
										<u--input border="none" size="mini" placeholder="请输入用药名称" v-model="item.name"
											fontSize="22rpx">
										</u--input>
									</view>
								</view>
							</view>
						</view>
						<view class="form-add">
							<u-icon name="plus" color="#54b6ab" size="16" @click="changeSize(4,1,index)"></u-icon>
							<u-icon name="minus" color="#54b6ab" @click="changeSize(4,0,index)"></u-icon>
						</view>
					</view>
					<view class="box-form">
						<view class="form-left">
							用药时间:
						</view>
						<view class="form-right">
							<uni-datetime-picker type="date" v-model="item.time" start="1990-01-01"
								:end="currentTime" />
						</view>
						<view class="form-add">

						</view>
					</view>
					<view class="box-form">
						<view class="form-left">
							日用药次数:
						</view>
						<view class="form-right">
							<view class="input-box-style">
								<view class="right-input-box" style="width: 100%;">
									<view class="input-box-style" style="width: 100%;margin: 0;">
										<u--input fontSize="22rpx" border="none" size="mini" placeholder="请输入日用药次数"
											type="number" v-model="item.num">

										</u--input>
									</view>
								</view>
							</view>
						</view>
						<view class="form-add">
							次
						</view>
					</view>
					<view class="box-form">
						<view class="form-left">
							单次药量:
						</view>
						<view class="form-right">
							<view class="input-box-style">
								<view class="right-input-box" style="width: 100%;">
									<view class="input-box-style" style="width: 100%;margin: 0;">
										<u--input fontSize="22rpx" border="none" size="mini" placeholder="请输入单次药量"
											type="digit" v-model="item.medicalWeight">

										</u--input>
									</view>
								</view>
							</view>
						</view>
						<view class="form-add">
							mg/ml/g
						</view>
					</view>
					<view class="box-form">
						<view class="form-left">
							已用药天数:
						</view>
						<view class="form-right">
							<view class="input-box-style">
								<view class="right-input-box" style="width: 100%;">
									<view class="input-box-style" style="width: 100%;margin: 0;">
										<u--input fontSize="22rpx" border="none" size="mini" placeholder="请输入已用药天数"
											type="number" v-model="item.useDay">

										</u--input>
									</view>
								</view>
							</view>
						</view>
						<view class="form-add">
							天
						</view>
					</view>
					<view class="box-form">
						<view class="form-left">
							药品图片:
						</view>
						<view class="form-right"
							style="display: flex;align-items: flex-start;justify-content: space-between;">
							<u-upload :fileList="item.imageUrl" @afterRead="afterRead" @delete="deletePic"
								uploadIconColor="#54b6ab" uploadIcon="plus" :name="{index:index,name:4}" :maxCount="1"
								accept="image"></u-upload>

						</view>
						<view class="form-add">

						</view>
					</view>

				</view>
			</u-transition>
		</view>
		<!-- 补充 -->
		<view class="clinical-box">
			<view class="box-header" :style="show5 == true ? '' : 'marginBottom:0'">
				<view class="header-left">
					<view class="left-line"></view>
					<text>补充
					</text>
				</view>
				<view>
					<u-icon :name="show5 ? 'arrow-up' : 'arrow-down'" bold @click="show5 = !show5"></u-icon>
				</view>
			</view>
			<u-transition show>
				<view v-show="show5">
					<view class="box-form">
						<view class="form-left">
							其他医院就诊病例:
						</view>
						<view class="form-right"
							style="display: flex;align-items: flex-start;justify-content: space-between;">
							<u-upload :fileList="form.otherMedicalHistoryArr" @afterRead="afterRead" @delete="deletePic"
								uploadIconColor="#54b6ab" uploadIcon="plus" :name="{index:index,name:5}" :maxCount="1"
								accept="image"></u-upload>

						</view>
						<view class="form-add">

						</view>
					</view>

				</view>
			</u-transition>
		</view>
		<!-- 组件底部按钮 -->
		<view class="clinical-box" style="background-color: transparent;" v-if="!setId||setId==null">
			<view class="foot-btns">
				<u-button type="primary" text="上一步" color="#54b6ab" @click="nextStep(3)" style="width: 40%;"></u-button>
				<u-button type="primary" color="#ffb049" text="开始问诊" style="width: 40%;" @click="submit"></u-button>
			</view>
		</view>

	</view>
</template>

<script>
	import global from '../common/global.js'
	export default {
		name: "medication",
		props: ['info', "clientId", "doctorId", "setId"],
		data() {
			return {
				currentTime: null,
				show1: true,
				show2: true,
				show3: true,
				show4: true,
				show5: true,
				form: {
					clientId: null,
					doctorId: null,
					morbidityCondition: 0, //发病情况 0初诊 1复诊
					timesNum: null, //复诊次数 初诊不填 复诊必填
					morbidityTime: null, //发病时间 初诊必填 复诊非必填
					feverDayNum: null, //发热天数
					highTemperature: null, //发热最高温度
					feverSymptom: 0, //发热症状 0无 1有
					symptomDetailArr: [], //发热症状详情
					feverTimeInterval: 0, //发热时间间隔 0持续发热 1间隔
					intervalTimeHour: null, //间隔小时
					feverMedicateStatus: 0, //发热用药 0无 1有
					medicateDetail: null, //用药详情
					heelExampleUrlArr: [], //足跟示例资源地址
					heelExampleType: null, //足跟示例资源类型 0图片 1视频
					heelColor: null, //足跟颜色
					heelTemperature: null, //足跟温度 1温 2凉 3热
					heelPressRedTime: null, //足跟按压变红 0 <=3秒  1>3秒
					heelHardness: null, //足心软硬度 1软(唇) 2韧(鼻) 3硬(额)
					coughDayNum: null, //咳嗽天数
					aggravateDayNum: null, //加重天数
					coughTimesArr: [], //咳嗽时间
					coughRelatedFactor: 0, //咳嗽相关因素0无 1有
					coughFactorDetailArr: [], //咳嗽相关因素详情
					coughVomitStatus: 0, //咳嗽呕吐 0无 1有
					coughAwakeningStatus: 0, //夜里咳醒 0无 1有
					feverCoughStatus: 0, //发热咳嗽 0无 1有
					coughPeculiarityArr: [], //咳嗽特点
					coughRecordedUrl: null, //咳嗽录音 可上床多条 用,隔开
					coughRecordedUrlArr: [], //咳嗽录音数组
					gaspStatus: 0, //喘息 0无 1有
					gaspDayNum: null, //喘息天数
					sneezeStatus: 0, //喷嚏 0无 1有
					sneezeDayNum: null, //喷嚏天数
					nasalObstructionStatus: 0, //鼻塞 0无 1有
					nasalObstructionDayNum: null, //鼻塞天数
					anginaStatus: 0, //咽痛 0无 1有
					anginaDayNum: null, //咽痛天数
					dullStatus: 0, //暗哑 0无 1有
					dullDegree: 1, //暗哑程度 1轻 2中 3重
					gaspBreathVideoUrlArr: [], //喘息或呼吸困难视频示例地址
					electronicStethoscopeUrlArr: [], //电子听诊器呼吸音地址
					kneadNoseEye: 0, //手揉鼻子眼睛 0无 1有
					eczemaStatus: 0, //幼时湿疹 0无 1有
					eczemaDegree: 1, //湿疹程度 1轻 2中 3重
					allergyRhinitis: 0, //过敏性鼻炎 0无 1有
					parentAllergyRhinitis: 0, //父母过敏性鼻炎 0无 1有
					allergySource: 0, //过敏原 0无 1有
					allergySourceDetail: null, //过敏原详情
					penicillinCephalosporinAllergy: 0, //青霉素/头孢过敏史 0无 1有
					otherAllergyMedicineDetail: null, //其他过敏药物
					foodAllergyMedicineDetail: null, //食物过敏详情
					recentRash: 0, //近两天皮疹 0无 1有
					lowerPartRash: 0, //下面部位皮疹 0无 1有
					lowerPartRashDetailArr: [], //下面部位皮疹详情
					rashShowType: null, //皮疹展示 0图片 1视频
					rashShowUrlArr: [], //皮疹展示资源地址
					otherExpression: 0, //有无下列表现 0无 1有
					otherExpressionDetailArr: [], //有下列表现详情
					otherIllness: 1, //其他疾病
					otherIllnessDetail: null, //其他疾病详情
					temperatureCheckArr: [],
					electronicTemperatureUrlArr: [],
					physicalAssayImageArr: [], //血常规详情
					physicalUrineReportArr: [], //尿常规详情
					chestRadiograph: 0, //是否有胸片
					chestRadiographArr: [], //胸片详情
					lungCt: 0, //是否有肺部CT
					lungCtArr: [], //肺部CT详情
					carbonMonoxideArr: [], //一氧化碳检测详情
					lungFeature: 0, //是否有肺功能
					lungFeatureArr: [], //肺功能检测详情
					bronchus: 0, //是否有支气管检查
					bronchusArr: [], //支气管检查详情
					illDayNum: null,
					takeOrallyArr: [],
					intravenousDripArr: [],
					atomizationArr: [],
					otherMedicalHistoryArr: [] //图片和pdf都支持
				},
				form2: {
					clientId: null,
					doctorId: null,
					morbidityCondition: 0, //发病情况 0初诊 1复诊
					timesNum: null, //复诊次数 初诊不填 复诊必填
					morbidityTime: null, //发病时间 初诊必填 复诊非必填
					feverDayNum: null, //发热天数
					highTemperature: null, //发热最高温度
					feverSymptom: 0, //发热症状 0无 1有
					symptomDetailArr: [], //发热症状详情
					feverTimeInterval: 0, //发热时间间隔 0持续发热 1间隔
					intervalTimeHour: null, //间隔小时
					feverMedicateStatus: 0, //发热用药 0无 1有
					medicateDetail: null, //用药详情
					heelExampleUrlArr: [], //足跟示例资源地址
					heelExampleType: null, //足跟示例资源类型 0图片 1视频
					heelColor: null, //足跟颜色
					heelTemperature: null, //足跟温度 1温 2凉 3热
					heelPressRedTime: null, //足跟按压变红 0 <=3秒  1>3秒
					heelHardness: null, //足心软硬度 1软(唇) 2韧(鼻) 3硬(额)
					coughDayNum: null, //咳嗽天数
					aggravateDayNum: null, //加重天数
					coughTimesArr: [], //咳嗽时间
					coughRelatedFactor: 0, //咳嗽相关因素0无 1有
					coughFactorDetailArr: [], //咳嗽相关因素详情
					coughVomitStatus: 0, //咳嗽呕吐 0无 1有
					coughAwakeningStatus: 0, //夜里咳醒 0无 1有
					feverCoughStatus: 0, //发热咳嗽 0无 1有
					coughPeculiarityArr: [], //咳嗽特点
					coughRecordedUrl: null, //咳嗽录音 可上床多条 用,隔开
					coughRecordedUrlArr: [], //咳嗽录音数组
					gaspStatus: 0, //喘息 0无 1有
					gaspDayNum: null, //喘息天数
					sneezeStatus: 0, //喷嚏 0无 1有
					sneezeDayNum: null, //喷嚏天数
					nasalObstructionStatus: 0, //鼻塞 0无 1有
					nasalObstructionDayNum: null, //鼻塞天数
					anginaStatus: 0, //咽痛 0无 1有
					anginaDayNum: null, //咽痛天数
					dullStatus: 0, //暗哑 0无 1有
					dullDegree: 1, //暗哑程度 1轻 2中 3重
					gaspBreathVideoUrlArr: [], //喘息或呼吸困难视频示例地址
					electronicStethoscopeUrlArr: [], //电子听诊器呼吸音地址
					kneadNoseEye: 0, //手揉鼻子眼睛 0无 1有
					eczemaStatus: 0, //幼时湿疹 0无 1有
					eczemaDegree: 1, //湿疹程度 1轻 2中 3重
					allergyRhinitis: 0, //过敏性鼻炎 0无 1有
					parentAllergyRhinitis: 0, //父母过敏性鼻炎 0无 1有
					allergySource: 0, //过敏原 0无 1有
					allergySourceDetail: null, //过敏原详情
					penicillinCephalosporinAllergy: 0, //青霉素/头孢过敏史 0无 1有
					otherAllergyMedicineDetail: null, //其他过敏药物
					foodAllergyMedicineDetail: null, //食物过敏详情
					recentRash: 0, //近两天皮疹 0无 1有
					lowerPartRash: 0, //下面部位皮疹 0无 1有
					lowerPartRashDetailArr: [], //下面部位皮疹详情
					rashShowType: null, //皮疹展示 0图片 1视频
					rashShowUrlArr: [], //皮疹展示资源地址
					otherExpression: 0, //有无下列表现 0无 1有
					otherExpressionDetailArr: [], //有下列表现详情
					otherIllness: 1, //其他疾病
					otherIllnessDetail: null, //其他疾病详情
					temperatureCheckArr: [],
					electronicTemperatureUrlArr: [],
					physicalAssayImageArr: [], //血常规详情
					physicalUrineReportArr: [], //尿常规详情
					chestRadiograph: 0, //是否有胸片
					chestRadiographArr: [], //胸片详情
					lungCt: 0, //是否有肺部CT
					lungCtArr: [], //肺部CT详情
					carbonMonoxideArr: [], //一氧化碳检测详情
					lungFeature: 0, //是否有肺功能
					lungFeatureArr: [], //肺功能检测详情
					bronchus: 0, //是否有支气管检查
					bronchusArr: [], //支气管检查详情
					illDayNum: null,
					takeOrallyArr: [],
					intravenousDripArr: [],
					atomizationArr: [],
					otherMedicalHistoryArr: [] //图片和pdf都支持
				},
			}
		},

		created() {
			this.currentTime = this.getNowFormatDate()
		},
		watch: {
			"$store.state.form": {
				handler(newVal, oldVal) {
					this.form = newVal
					if (!this.form.takeOrallyArr || this.form.takeOrallyArr.length == 0) {
						this.form.takeOrallyArr = [{
							name: null,
							time: null,
							num: null,
							medicalWeight: null,
							useDay: null,
							imageUrl: []
						}]
					}
					if (!this.form.intravenousDripArr || this.form.intravenousDripArr.length == 0) {
						this.form.intravenousDripArr = [{
							name: null,
							time: null,
							num: null,
							medicalWeight: null,
							useDay: null,
							imageUrl: [],
							useWay: null
						}]
					}
					if (!this.form.atomizationArr || this.form.atomizationArr.length == 0) {
						this.form.atomizationArr = [{
							name: null,
							time: null,
							num: null,
							medicalWeight: null,
							useDay: null,
							imageUrl: []
						}]
					}
					if (!this.form.otherMedicalHistoryArr || this.form.otherMedicalHistoryArr.length == 0) {
						this.form.otherMedicalHistoryArr = []
					}
				},
				immediate: true,
				// deep: true

			},

			// info(item1, item2) {
			// 	this.form = item1
			// 	if (!this.form.takeOrallyArr||this.form.takeOrallyArr.length==0) {
			// 		this.form.takeOrallyArr = [{
			// 			name: null,
			// 			time: null,
			// 			num: null,
			// 			medicalWeight: null,
			// 			useDay: null,
			// 			imageUrl: []
			// 		}]
			// 	}
			// 	if (!this.form.intravenousDripArr||this.form.intravenousDripArr.length==0) {
			// 		this.form.intravenousDripArr = [{
			// 			name: null,
			// 			time: null,
			// 			num: null,
			// 			medicalWeight: null,
			// 			useDay: null,
			// 			imageUrl: [],
			// 			useWay: null
			// 		}]
			// 	}
			// 	if (!this.form.atomizationArr||this.form.atomizationArr.length==0) {
			// 		this.form.atomizationArr = [{
			// 			name: null,
			// 			time: null,
			// 			num: null,
			// 			medicalWeight: null,
			// 			useDay: null,
			// 			imageUrl: []
			// 		}]
			// 	}
			// 	if (!this.form.otherMedicalHistoryArr||this.form.otherMedicalHistoryArr.length==0) {
			// 		this.form.otherMedicalHistoryArr = []
			// 	}
			// }
		},
		methods: {
			getNowFormatDate() {
				let date = new Date(),
					year = date.getFullYear(), //获取完整的年份(4位)
					month = date.getMonth() + 1, //获取当前月份(0-11,0代表1月)
					strDate = date.getDate() // 获取当前日(1-31)
				if (month < 10) month = `0${month}` // 如果月份是个位数，在前面补0
				if (strDate < 10) strDate = `0${strDate}` // 如果日是个位数，在前面补0

				return `${year}-${month}-${strDate}`
			},
			//提交问诊
			async submit() {
				// this.form.clientId = this.clientId
				//判断
				if (this.form.morbidityCondition == 0 && !this.form.morbidityTime) {
					return uni.showToast({
						icon: 'none',
						title: '初诊必须填写发病时间'
					})
				}
				if (this.form.morbidityCondition == 1 && !this.form.timesNum) {
					return uni.showToast({
						icon: 'none',
						title: '复诊必须填写复诊次数'
					})
				}
				if(!this.form.feverDayNum||!this.form.highTemperature){
					return uni.showToast({
						icon: 'none',
						title: '请填写发热天数和最高温度'
					})
				}
				if(this.form.feverSymptom==1&&this.form.symptomDetailArr.length==0){
					return uni.showToast({
						icon: 'none',
						title: '请选择发热相关症状'
					})
				}
				if(this.form.feverTimeInterval==1&&!this.form.intervalTimeHour){
					return uni.showToast({
						icon: 'none',
						title: '请输入间隔发热时间'
					})
				}
				if(this.form.feverMedicateStatus==1&&!this.form.medicateDetail){
					return uni.showToast({
						icon: 'none',
						title: '请输入发热用药详情'
					})
				}
				if (!this.$store.state.form.doctorId) {
					uni.setStorageSync('submitInfo', JSON.stringify(this.form))
					uni.navigateTo({
						url: '/pages/chooseDoctor'
					})
					return false
				}
				// this.form.doctorId = this.doctorId
				const {
					data
				} = await uni.$http.post('/patient-interrogationRecords/submitMedical', this.form)
				if (data.code === 200) {
					uni.removeStorageSync('doctorId')
					uni.removeStorageSync('submitInfo')
					this.$store.commit('setInterrogationInfo', this.form2)
					uni.showToast({
						icon: 'none',
						title: data.message
					})
				}
			},
			//上下一步
			nextStep(val) {
				this.$emit('nextStep', val)
			},
			changeSize(i, type, index) {
				if (type === 1) {
					//+
					if (i === 2) {
						//口服
						this.form.takeOrallyArr.push({
							name: null,
							time: null,
							num: null,
							medicalWeight: null,
							useDay: null,
							imageUrl: []
						})
						this.show2 = false
						this.$nextTick(() => {
							this.show2 = true;
						})
					}

					if (i === 3) {
						//静滴
						this.form.intravenousDripArr.push({
							name: null,
							time: null,
							num: null,
							medicalWeight: null,
							useDay: null,
							imageUrl: [],
							useWay: null
						})
						this.show3 = false
						this.$nextTick(() => {
							this.show3 = true;
						})
					}

					if (i === 4) {
						//雾化
						this.form.atomizationArr.push({
							name: null,
							time: null,
							num: null,
							medicalWeight: null,
							useDay: null,
							imageUrl: []
						})
						this.show4 = false
						this.$nextTick(() => {
							this.show4 = true;
						})
					}

				} else {
					//-
					if (i === 2) {
						//口服
						if (this.form.takeOrallyArr && this.form.takeOrallyArr.length === 1) {
							return uni.showToast({
								icon: 'none',
								title: '不能再减啦'
							})
						} else {
							this.form.takeOrallyArr.splice(index, 1)
							this.show2 = false
							this.$nextTick(() => {
								this.show2 = true;
							})
						}
					}

					if (i === 3) {
						//静滴
						if (this.form.intravenousDripArr && this.form.intravenousDripArr.length === 1) {
							return uni.showToast({
								icon: 'none',
								title: '不能再减啦'
							})
						} else {
							this.form.intravenousDripArr.splice(index, 1)
							this.show3 = false
							this.$nextTick(() => {
								this.show3 = true;
							})
						}
					}

					if (i === 4) {
						//雾化
						if (this.form.atomizationArr && this.form.atomizationArr.length === 1) {
							return uni.showToast({
								icon: 'none',
								title: '不能再减啦'
							})
						} else {
							this.form.atomizationArr.splice(index, 1)
							this.show4 = false
							this.$nextTick(() => {
								this.show4 = true;
							})
						}
					}

				}
			},
			async afterRead(file, lists, name) {
				uni.showLoading({
					title: '上传中',
				})
				let a = uni.uploadFile({
					url: global.api + '/system/uploadFile', // 仅为示例，非真实的接口地址
					filePath: file.file.url,
					name: 'file',
					header: {
						token: uni.getStorageSync('token')
					},
					success: (res) => {
						let result = JSON.parse(res.data)
						if (result.code === 200) {
							let obj = {}
							obj.url = result.data
							if (file.name.name === 2) {
								//口服
								this.form.takeOrallyArr[file.name.index].imageUrl
									.push(obj)
								// this.show2 = false
								// this.$nextTick(() => {
								// 	this.show2 = true;
								// })
							}
							if (file.name.name === 3) {
								//静滴
								this.form.intravenousDripArr[file.name.index].imageUrl
									.push(obj)
								// this.show3 = false
								// this.$nextTick(() => {
								// 	this.show3 = true;
								// })
							}
							if (file.name.name === 4) {
								//雾化
								this.form.atomizationArr[file.name.index].imageUrl
									.push(obj)
								// this.show4 = false
								// this.$nextTick(() => {
								// 	this.show4 = true;
								// })
							}
							if (file.name.name === 5) {
								//其他补充
								this.form.otherMedicalHistoryArr
									.push(obj)
								// this.show5 = false
								// this.$nextTick(() => {
								// 	this.show5 = true;
								// })
							}
							uni.hideLoading()
						} else {
							uni.hideLoading()
						}
					}
				})
			},
			deletePic(event) {
				if (event.name.name === 2) {
					//口服
					this.form.takeOrallyArr[event.name.index].imageUrl.splice(event.index, 1)
					// this.show2 = false
					// this.$nextTick(() => {
					// 	this.show2 = true;
					// })
				}
				if (event.name.name === 3) {
					//静滴
					this.form.intravenousDripArr[event.name.index].imageUrl.splice(event.index, 1)
					// this.show3 = false
					// this.$nextTick(() => {
					// 	this.show3 = true;
					// })
				}
				if (event.name.name === 4) {
					//雾化
					this.form.atomizationArr[event.name.index].imageUrl.splice(event.index, 1)
					// this.show4 = false
					// this.$nextTick(() => {
					// 	this.show4 = true;
					// })
				}
				if (event.name.name === 5) {
					//其他补充
					this.form.otherMedicalHistoryArr.splice(event.index, 1)
					// this.show5 = false
					// this.$nextTick(() => {
					// 	this.show5 = true;
					// })
				}
			}
		}
	}
</script>

<style lang="scss" scoped>
	// @import url('@/static/css/components.css');
	.clinical {
		width: 100%;
		height: 100%;
		overflow: auto;

		.clinical-box {
			width: 100%;
			background-color: #fff;
			border-radius: 20rpx;
			padding: 20rpx;
			box-sizing: border-box;
			margin-bottom: 20rpx;

			.box-header {
				display: flex;
				align-items: center;
				justify-content: space-between;
				margin-bottom: 20rpx;

				.header-left {
					display: flex;
					align-items: stretch;
					color: #54b6ab;

					.left-line {
						width: 10rpx;
						background-color: #54b6ab;
						margin-right: 10rpx;
					}
				}
			}

			.box-form {
				box-sizing: border-box;
				width: 100%;
				display: flex;
				align-items: center;
				justify-content: center;
				margin-bottom: 20rpx;

				.form-left {
					width: 30%;
					display: flex;
					align-items: flex-start;
					justify-content: flex-start;
				}

				.form-right {
					width: 50%;

					/deep/.uni-input-placeholder {
						font-size: 20rpx;
					}

					.right-input-box {
						display: flex;
						align-items: center;

						.input-box-style {
							padding-left: 10rpx;
							width: 80rpx;
							background-color: #f2f2f2;
							border-radius: 10rpx;
							margin: 0 10rpx;
							box-sizing: border-box;
						}
					}

					.video-btn {
						padding: 10rpx 20rpx;
						box-sizing: border-box;
						border: 1rpx solid #54b6ab;
						color: #54b6ab;
						display: flex;
						border-radius: 10rpx;
					}

					.media-text {
						color: #54b6ab;
					}

					.foot-color {
						position: relative;
						width: 49%;
						height: 70rpx;
						background-color: #d9d9d9;
						margin-bottom: 10rpx;
						box-sizing: border-box;
					}

					.text-btn {
						display: flex;
						flex-direction: column;
						align-items: flex-end;
						justify-content: space-between;
						color: #6897ff;
					}

					.footActive {
						border: 2rpx solid #54b6ab;
					}

					/deep/.uni-date__x-input {
						background-color: #f2f2f2;
						padding-left: 10rpx;
						border-radius: 10rpx;
					}

					/deep/.u-checkbox-group--row {
						flex-wrap: wrap;
					}
				}

				.form-add {
					width: 20%;
					display: flex;
					align-items: center;
					justify-content: space-around;
				}
			}

			.foot-btns {
				width: 100%;
				display: flex;
				align-items: center;
				justify-content: space-around;
			}

			.box-text {
				width: 100%;
				margin-bottom: 20rpx;
			}
		}

		.clinical-tab {
			width: 100%;
			margin-bottom: 20rpx;

			.tab-header {
				display: flex;
				align-items: center;
				justify-content: space-between;
				background-color: #54b6ab;
				color: #fff;
				padding: 20rpx 0;
				box-sizing: border-box;

				.text-box1 {
					display: flex;
					width: 33%;
					align-items: center;
					justify-content: center;
				}

			}
		}


	}
</style>